#ifndef __RESTREMINDER_H__
#define __RESTREMINDER_H__

#include <QApplication>
#include <QDebug>
#include <QWidget>
#include <ctime>
#include <QSystemTrayIcon>
#include <QElapsedTimer>

#define DEFAULT_REST_AMOUNT_TIME 10
#define DEFAULT_REMIND_INTERVAL 5
#define TIME_UNIT 1

#if defined(Q_OS_LINUX)
#include "maintainworktimestampsthread.h"
#elif defined(Q_OS_WIN)
#include <Windows.h>
#include <qelapsedtimer.h>
#endif

QT_BEGIN_NAMESPACE
class QTimer;
class QtGlobal;
class QDebug;
class QSettings;
QT_END_NAMESPACE

class KRestReminder : public QWidget
{
	Q_OBJECT
public slots:
	void detectTimeout();

public:
	KRestReminder(QSystemTrayIcon *trayIcon, QWidget *parent = 0);
	~KRestReminder();
#if defined(Q_OS_WIN)
	static LRESULT CALLBACK LowLevelMouseProc(_In_ int nCode, 
	_In_ WPARAM wParam,
	_In_ LPARAM lParam
	);
    static LRESULT CALLBACK LowLevelKeyboardProc(
	_In_  int nCode,
	_In_  WPARAM wParam,
	_In_  LPARAM lParam
	);
#endif
	void start();
	void restart();
	int getWorkAmountTime();
	void setWorkAmountTime(int workAmountTime);

		
private:
	static QElapsedTimer *sm_workTotalTime;
    static QElapsedTimer *sm_restTotalTime;
	QTimer *m_timer;
	int m_restAmountTime;  
	int m_workAmountTime;

	int m_startWorkTimestamp;
	int m_stopWorkTimestamp;

	bool m_showStartUpMessage;
	QSystemTrayIcon *m_trayIcon;

#if defined(Q_OS_LINUX)
	KMaintainWorkTimestampsThread *m_maintainThread;
#endif
};

#endif
